<html>
    <head>
        <title></title>
        <script type="text/javascript">
            //质数练习
            var num = prompt("请输入一个大于1的整数:");
            if(num <= 1)
            {
                alert("这个值不合法");
            }
            else
            {
                var flag = true;

                for(var i = 2; i < Math.sqrt(num); i++)
                {
                    if(num % i == 0)
                    {
                       
                        flag = false;
                    }
                }

                if(flag)
                {
                    alert(num + "是质数");
                }
                else
                {
                    alert(num + "不是质数");
                }
            }

        </script>
    </head>

    <body>

    </body>
</html>